package com.cndatacom.eweb.service.impl;

import com.cndatacom.eweb.common.PaginationModel;
import com.cndatacom.eweb.dao.IRoleDao;
import com.cndatacom.eweb.model.Role;
import com.cndatacom.eweb.model.UserRole;
import com.cndatacom.eweb.service.IRoleService;

public class RoleService implements IRoleService {

	private IRoleDao roleDao;
	
	public Role addOrUpdateRole(Role role) {
		return roleDao.addOrUpdateRole(role);
	}

	public boolean addOrUpdateUserRole(UserRole userRole) {
		return roleDao.addOrUpdateUserRole(userRole);
	}

	public boolean deleteRole(Role role) {
		return roleDao.deleteRole(role);
	}

	public boolean deleteUserRole(UserRole userRole) {
		return roleDao.deleteUserRole(userRole);
	}

	public PaginationModel getAllRole(int offset, int pageSize, boolean paging) {
		return roleDao.getAllRole(offset, pageSize, paging);
	}

	public PaginationModel getAllRoleUsers(int roleId, int offset, int pageSize) {
		return roleDao.getAllRoleUsers(roleId, offset, pageSize);
	}

	public Role getRoleById(int id) {
		return roleDao.getRoleById(id);
	}

	public UserRole getUserRoleByUseridAndRoleid(int userId, int roleId) {
		return roleDao.getUserRoleByUseridAndRoleid(userId, roleId);
	}

	public IRoleDao getRoleDao() {
		return roleDao;
	}
	public void setRoleDao(IRoleDao roleDao) {
		this.roleDao = roleDao;
	}

}

